package aop.test.proxy;

import cn.stimd.spring.aop.framework.AopContext;

/**
 * Created by Stimd
 * 项目地址：https://gitee.com/stimd/spring-wheel
 * 公众号：Java编程探微
 */
public class CglibTarget {

    public void handle() {
        System.out.println("执行handle方法");
    }


    public void step1(){
        System.out.println("执行step1...");
        System.out.println("-------------------------");

        //直接调用，不会触发拦截
        this.step2();
        System.out.println("-------------------------");

        //通过对外暴露的代理对象调用会触发拦截
        CglibTarget proxy = (CglibTarget) AopContext.currentProxy();
        proxy.step2();
    }

    public void step2(){
        System.out.println("执行step2...");
    }
}
